/*	Problem: http://codeforces.ru/problemset/problem/100/B
	  Verdict: Accepted
*/
int main(){
        string s=Stdio.stdin->gets();
        int n,i,j;
        array(int) p;
        sscanf(s,"%d",n);
        p = allocate(n);
        s=Stdio.stdin->gets();
        for(i=0;i+1<n;++i)sscanf(s,"%d,%s",p[i],s);
        sscanf(s,"%d",p[n-1]);
        int x=0;
        for(i=0;i<n;++i)for(j=i+1;j<n;++j)if(p[i]%p[j]!=0 && p[j]%p[i]!=0)x=1;
        if(x==1)write("NOT FRIENDS\n");else write("FRIENDS\n");
        string ssss=Stdio.stdin->gets();
        return 0;
}